This section describes two Image Compression Manager functions that enable you to select graphics devices and create graphics worlds. You can use the GetBestDeviceRect function to select the best available graphics device. The NewImageGWorld function allows you to create a graphics world based on the width, height, depth, and color table of a specified image description structure.
The GetBestDeviceRect function selects the deepest of all available graphics devices, while treating 16-bit and 32-bit screens as having equal depth.
pascal OSErr GetBestDeviceRect (GDHandle *gdh, Rect *rp);
If multiple 16-bit and 32-bit monitors are available, the GetBestDeviceRect function selects the 16-bit or 32-bit device upon which the cursor has currently been detected. If a cursor is not on one of the devices in question, the first of those in the list is chosen.
Note that the GetBestDeviceRect function does not center a rectangle on a device. Rather, it returns the rectangle for the best device.
The NewImageGWorld function creates a graphics world from the width, height, depth, and color table of a specified image-description structure.
pascal OSErr NewImageGWorld (GWorldPtr *gworld,
ImageDescriptionHandle idh,
GWorldFlags flags);
The NewImageGWorld function selects the appropriate color table using the depth field or custom color table in the image description structure. It creates a 32-bit-deep graphics world if the depth specified in the image description structure is 24.